appId = 'p4po2ekr5r78quspni4ryzhedfv952h3o18oacqahh7ie3k5'
appMaster = 'ks9nwtdabuc2kynkcxm6vtgpawfh0329rnrgm4owtwqywth7'
ms = new Date().getTime()
requestSign = md5(ms + appMaster)
apiPre = 'https://leancloud.cn/1.1/'
headers =
  "Content-Type": "application/json"
  "X-AVOSCloud-Application-Id": appId
  "X-AVOSCloud-Request-sign": requestSign + ',' + ms + ',master'

L =
  sendSmsCode: (mobilePhoneNumber) ->
    return new Promise (resolve, reject) ->
      $.ajax
        url: apiPre + 'requestSmsCode'
        type: 'post'
        headers: headers
        data:
          mobilePhoneNumber: mobilePhoneNumber
  signin: (phone, password) ->
    return new Promise (resolve, reject) ->
      $.ajax
        url: apiPre + 'usersByMobilePhone'
        type: 'post'
        headers: headers
        data:
          "mobilePhoneNumber": ""
          "smsCode": ""
      .done (ret) ->
        resolve ret
      .error (err) ->
        reject err
